package com.woniu.smallmedical.controller;

import com.woniu.smallmedical.entity.InventoryDetail;
import com.woniu.smallmedical.entity.PageBean;
import com.woniu.smallmedical.entity.ResponseResult;
import com.woniu.smallmedical.mapper.InventoryDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@CrossOrigin
@RestController
public class InventoryDetailController {

    @Autowired
    InventoryDetailMapper basicmessageapper;



    @GetMapping("/Inventorymessage")
    public ResponseResult medicine(Integer pageIndex, Integer pageSize,Integer inid){
        List<InventoryDetail> basicmessages = basicmessageapper.selectBuinid(pageIndex,pageSize,inid);
        PageBean<InventoryDetail> pageBean=new PageBean<>();
        System.out.println("basicmessages+"+basicmessages);
        pageBean.setPageBeanList(basicmessages);
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecord(basicmessageapper.selectcount(inid));
        return new ResponseResult<PageBean<InventoryDetail>>(pageBean,200,"OK");
    }

}
